﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model List<ECG.Common.ProductByCateTopListPagingDto>
@if (Model.Any())
{
    <div class="cate-topPromotion">
        <div class="toppromotion-header">
            <i></i>
            @*<a href="" class="cate-promo-all">xem tất cả</a>*@
            <div class="topPro-padding">
                <span class="topPromo-text">top sản phẩm <b>được quan tâm
                </b></span>
                <br />
                <span class="topPromo-text-2">
                    <b>Website / </b>bán các sản phẩm dành cho Mẹ và Bé chất lượng giá tốt
                </span>
            </div>
        </div>
        <div class="toppromotion-body">
            <a href="javascript:void(0);" class="pIten-back" rel="nofollow" >Back</a>
            <a href="javascript:void(0);" class="pIten-next" rel="nofollow">Next</a>
            <input type="hidden" name="hidCurrentPage" class="hidTotalPage" value="@ViewBag.TotalPage"/>
            <input type="hidden" name="hidCategory" class="hidCategory" value="@ViewBag.Category"/>
            <input type="hidden" name="hidCurrentPage" class="hidCurrentPage" value="@ViewBag.CurrentPage"/>
            <ul class="listp ul clearfix">
                @foreach (var item in Model)
                {
                    var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                    <li>
                        <div class="pItem">
                            <a href="@pDetailLink" class="pItem-lnkImg">
                                @if (item.DiscountPercentage > 0)
                                {
                                    <span class="pItem-per">-@item.DiscountPercentage.ToString("#.#")<i>%</i></span>
                                }
                                <img src="@item.ImagePath.ImagePathThumb(135, 135)" width="135" height="135" alt="@item.Name" class="lzLoading" />
                            </a>
                            <div class="pItem-info">
                                <h2>
                                    <a href="@pDetailLink">@item.Name</a>
                                </h2>
                                @if (item.PromotionPrice > 0)
                                {
                                    <p class="pItem-PriceOld">
                                        @item.Price.ToString("##,###,###") đ
                                    </p>
                                    <p class="pItem-PriceNew">
                                        @if (item.CreateDate >= DateTime.Now)
                                        {
                                            <i>MỚI</i>
                                        }

                                        @item.PromotionPrice.ToString("##,###,###") <strong>đ</strong>
                                    </p>
                                }
                                else
                                {
                                    <p class="pItem-PriceNew">
                                        @if (item.CreateDate >= DateTime.Now)
                                        {
                                            <i>MỚI</i>
                                        }
                                        @item.Price.ToString("##,###,###") <strong>đ</strong>
                                    </p>
                                }
                                @if (item.DiscountPercentage <= 0)
                                {
                                    <p style="padding-top: 5px;">
                                        <span class="totalView" title="có @item.TotalView người xem">@item.TotalView</span>
                                    </p>
                                }
                            </div>
                        </div>
                    </li>
                }
            </ul>
        </div>
    </div>
}